// components/ratioItem/index.js
const {
  voluntaryTemplateAdd
} = require('../../api/ai')
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    item: {
      type: Object,
      value: {}
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    async voluntaryAdd(e) {
      const {name}=e.currentTarget.dataset
      this.setData({
        schoolName:name
      })
      const {
        firstSelectSubjects,
        score,
        ranking,
        province,
        provinceId,
        secondSelectSubjects
      } = wx.getStorageSync('subjectInfo')
      let params = {
        firstSelect: firstSelectSubjects,
        province,
        provinceId,
        score,
        secondSelect: secondSelectSubjects,
        ranking,
      }
      const {
        result
      } = await voluntaryTemplateAdd(params)
      this.navigate(result)
    },
    navigate(result) {
      const params = result
      params.level1Name = result.useBatch == '本科批' ? '本科' : '专科（高职）'
      params.schoolName=this.data.schoolName
      wx.navigateTo({
        url: '/pages/volunteer/select/index?params=' + encodeURIComponent(JSON.stringify(params))
      })

    },
  }
})